﻿namespace WMS6.Web.TransportManagement
{
    using System;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using WMS6.Web;

    public class PODQuery : BasePage
    {
        protected Button btnExport;
        protected Button btnList;
        protected Button btnNew;
        protected Button btnSearch;
        protected DropDownList ddlBolDetailID;
        protected DropDownList ddlCarrierID;
        protected DropDownList ddlCreateBy;
        protected DropDownList ddlDeliveryOrderID;
        protected DropDownList ddlOrderID;
        protected DropDownList ddlSignBy;
        protected DropDownList ddlSignDate;
        protected DropDownList ddlStatusOper;
        protected DropDownList ddrStatus;
        protected HtmlForm F8050;
        protected HtmlInputHidden hdnActionID;
        protected Label lblBolDetailID;
        protected Label lblBu;
        protected Label lblCarrierID;
        protected Label lblCreateBy;
        protected Label lblDeliveryOrderID;
        protected Label lblOrderID;
        protected Label lblSignBy;
        protected Label lblSignDate;
        protected Label lblStatus;
        protected HtmlLink mycss;
        protected ScriptManager ScriptManager1;
        protected TextBox txtBolDetailID;
        protected TextBox txtCarrierID;
        protected TextBox txtCreateBy;
        protected TextBox txtDeliveryOrderID;
        protected TextBox txtOrderID;
        protected TextBox txtSignBy;
        protected TextBox txtSignDate;

        protected void btnList_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("PODList.aspx?action={0}&from=list", base.UrlEncode(this.hdnActionID.Value.Trim())), false);
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("PODList.aspx?action={0}", base.UrlEncode(this.hdnActionID.Value.Trim())), false);
        }

        private void LoadDll()
        {
            base.BindData2DDLBySysCode(this.ddlStatusOper, "PodStatus");
            this.ddlStatusOper.Items.Insert(0, new ListItem("-----", ""));
            base.InitQueryDDL(this.ddlDeliveryOrderID, 0);
            base.InitQueryDDL(this.ddlCarrierID, 0);
            base.InitQueryDDL(this.ddlOrderID, 0);
            base.InitQueryDDL(this.ddlBolDetailID, 0);
            base.InitQueryDDL(this.ddlSignBy, 0);
            base.InitQueryDDL(this.ddlSignDate, 0);
            base.InitQueryDDL(this.ddrStatus, 0);
            base.InitQueryDDL(this.ddlCreateBy, 0);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                base.InitPage(this.Page);
                this.LoadDll();
                if (!string.IsNullOrEmpty(base.Request.QueryString["action"]))
                {
                    this.btnExport.Visible = false;
                    this.btnNew.Visible = false;
                }
            }
        }

        public string BolDetailID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtBolDetailID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtBolDetailID.Text.Trim(), this.ddlBolDetailID.SelectedValue);
                }
                return "";
            }
        }

        public string CarrierID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtCarrierID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtCarrierID.Text.Trim(), this.ddlCarrierID.SelectedValue);
                }
                return "";
            }
        }

        public string CreateBy
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtCreateBy.Text.Trim()))
                {
                    return base.GetParamsString(this.txtCreateBy.Text.Trim(), this.ddlCreateBy.SelectedValue);
                }
                return "";
            }
        }

        public string DeliveryOrderID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtDeliveryOrderID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtDeliveryOrderID.Text.Trim(), this.ddlDeliveryOrderID.SelectedValue);
                }
                return "";
            }
        }

        public string OrderID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtOrderID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtOrderID.Text.Trim(), this.ddlOrderID.SelectedValue);
                }
                return "";
            }
        }

        public string SignBy
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtSignBy.Text.Trim()))
                {
                    return base.GetParamsString(this.txtSignBy.Text.Trim(), this.ddlSignBy.SelectedValue);
                }
                return "";
            }
        }

        public string SignDate
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtSignDate.Text.Trim()))
                {
                    return base.GetParamsString(this.txtSignDate.Text.Trim(), this.ddlSignDate.SelectedValue);
                }
                return "";
            }
        }

        public string Status
        {
            get
            {
                if (!string.IsNullOrEmpty(this.ddlStatusOper.SelectedValue))
                {
                    return base.GetParamsString(this.ddlStatusOper.SelectedValue, this.ddrStatus.SelectedValue);
                }
                return "";
            }
        }
    }
}

